Skip to content

Image screen cover mode#201

Open
JorxPi wants to merge 3 commits into
mainfrom
image_screen_cover_mode
Open

Image screen cover mode#201
JorxPi wants to merge 3 commits into
mainfrom
image_screen_cover_mode

Conversation

@JorxPi

@JorxPi JorxPi commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This PR improves UI resizing behaviour across different viewport and window sizes.

The UI was not resizing consistently across editor/game viewports and different window sizes. Some screen space UI elements were being calculated using the wrong viewport dimensions, and swapchain render surfaces was returning incorrect sizes which were depending on the last attached texture. This caused full screen UI backgrounds and menu layouts to appear cropped, offset, or scaled incorrectly.

The changes done are the following:

  • Added a new Cover draw mode for UIImage, allowing background images to fill the available rect while preserving their aspect ratio.
  • Separated RenderSurface logical size tracking from texture attachment, so attaching textures no longer implicitly changes the surface size.
  • Updated the swapchain render surface to set its logical size explicitly after creation or resizing.
  • Changed UI command generation to be built per render viewport, using the current RenderSurface size instead of relying on a single global viewport size.

After all the improvement, here I put a video with the final result of the Main_Menu resizing correctly. It still needs one last change, which is detaching the Credits and Controlls text from the background, this way the background can use the Cover Mode and the text can use normal stretch.

https://youtu.be/rFnAnqz1dTY

I also attach you the new Main_Menu scene if you would like to test yourselves. Once this Pr is accepted I will move the scene to the BoundByDeath project.

Main_Menu.zip

@AndreuMiroSabate AndreuMiroSabate left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good changes. This fix was needed, and now the UI resize is getting close to a completely good functionality. Keep the good work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants